@include('Home.head')
<style>

    .el-carousel__item:nth-child(2n) {
        background-color: #99a9bf;

    }

    .el-carousel__item:nth-child(2n+1) {
        background-color: #d3dce6;
    }


    .el-carousel__item img{
        width:100%;
        height:100%;
    }



    .clothes-div
    {
        overflow:hidden;
        display: inline-block;
        margin: 5px;
    }
    .am-btn.am-btn-default.specs
    {
        float: left;
        margin-right: 3%;
        /* width: 65px; */
        height: 40px;
        border-radius: 5px;
        color: #fff;
        background: #919891;
        text-align: center;
        margin-top: 1%;
        margin-bottom: 1%;
        outline: none;
    }
    .specs-p
    {
        margin-top: 5%;
    }
    
    .am-tab-panel img{
        width: 100%;
    }
	.hearbc{
		/* border-bottom:#EE4000 2px solid; */
		background-color: #FFFFFF;
		
	}
	.textwei{
		font-weight: 700;
		color: red;
	}
	.h1w{
		width: 158px;
	}
	.am-tabs-bd{
		border: none;
	}
	.am-tabs-d2 .am-tabs-nav>.am-active:after{
		border-bottom-color:white;
	}
	
	
	.swiper-container {
	        width: 100%;
	
	        /* overflow: hidden; */
	    }
	
	    label {
	        margin-bottom: 0px;
	        font-weight: 100;
	    }
	
	    /*.swiper-container img {*/
	    /*    width: 100%;*/
		/*	height: 375px;*/
	    }
	
	    .swiper-pagination-bullet-active {
	        background: #6a6a6a !important;
	    }
	
	    .swiper-pagination-bullets {
	        bottom: 90px;
	    }
	
	    .video-js {
	        width: 100%;
	        height: 210px;
	    }
	
	    .buttom {
	        color: black;
	        border: 1px solid;
	        padding: 0 5px;
	        display: inline-block;
	        width: 25px;
	        text-align: center;
	    }
	
	    .number_s {
	        background-color: #fff;
	
	
	        margin: 10px 0px;
	        padding: 15px 17px;
	        border-radius: 6px;
	
	    }
	
	    /* #course ul {
	    display: block;
	    justify-content: space-around;
	    margin-top: 0;
	    color: #c3c3c3;
	} */
	    .Specifications {
	        color: black;
	
	
	    }
	
	    .Specifications1 {
	        /* height:100px */
	    }
	
	    .Specifications2 {
	        display: none
	    }
	
	    #course ul {
	        display: inline-flex;
	
	    }
	
	    .stock {
	        margin: 0 0 0 150px
	    }
	
	    #app {
	        overflow: hidden;
	    }
	
	    .Specifications_input {
	        display: none
	    }
	
	    .Specifications_xz {
	
	        background: #FFFFFF;
	        text-align: center;
	        border: 1px solid #A7AEBF;
	        border-radius: 20px;
	        font-size: 12px;
	        margin-top: 10px;
	        margin-right: 15px;
	        margin-bottom: 5px;
	        padding: 6px 10px;
	        height: 26px;
	        line-height: 14px;
	
	    }
	
	    .row {
	        display: inline-block;
	    }
	
	    .scrollspy-nav a {
	        color: #333333
	    }
	
	    .scrollspy-nav a.am-active {
	        color: #2B8DFF
	    }
	
	    .scrollspy-nav a.am-active:after {
	        background-color: #2B8DFF;
	        width: 50%;
	        left: 20px;
	    }
	
	    .oldprice {
	        text-decoration: line-through;
	        font-size: 12px;
	        color: #999999;
	        font-weight: Regular;
	        padding-left: 10px
	    }
	
	    * + h1, * + h2, * + h3, * + h4, * + h5, * + h6 {
	        margin-top: 0px
	    }
	
	    #course ul {
	        margin-top: 0px;
	        justify-content: space-between;
	    }
	
	    .nowprice {
	        color: #E85B4D;
	        font-size: 24px;
	        font-weight: 900;
	    }
	
	    .buttom {
	        border: none;
	        color: #333333;
	        font-size: 16px;
	        font-weight: Bold;
	
	    }
	
	    a:focus, a:hover {
	        color: #000
	    }
	
	    input {
	        background: none;
	        outline: none;
	        border: none;
	    }
	
	    .font {
	        color: #333333;
	        font-size: 16px;
	        font-weight: Medium;
	
	    }
	
	    .module {
	        background: #fff;
	        margin-bottom: 10px
	    }
	
	    #comment .comment-hd {
	        padding: 15px;
	    }
	
	    #comment .comment-hd .comment-more {
	        color: #A7AEBF;
	        font-size: 12px;
	        font-weight: Regular;
	
	    }
	
	    .recommend .recommend-bd .am-gallery-item .am-gallery-desc {
	
	        margin-top: 10px;
	    }
	
	    .btngm {
	        width: 134px;
	        height: 38px;
	        background: #2B8DFF;
	        box-shadow: 0px 3px 6px rgba(43, 141, 255, 0.2);
	        opacity: 1;
	        border-radius: 20px;
	        line-height: 38px
	    }
	
	    p {
	        padding: 10px;
	    }
	
	    .scrollspy-nav a.am-active:after {
	        background-color: #2B8DFF;
	        width: 50%;
	        left: 24px;
	    }
	
	
	    .number_s {
	
	        background-color: #fff;
	
	        margin: 10px 0px;
	        padding: 15px 15px;
	        border-radius: 6px;
	    }
	
	    .recommend .recommend-bd .am-gallery-default > li:nth-child(2n) {
	        padding-left: 4px;
	
	    }
	
	    .recommend .recommend-bd .am-gallery-item {
	        box-shadow: 0px 10px 9px #eee;
	        padding: 0px;
	        border-top-left-radius: 10px;
	        border-top-right-radius: 10px;
	    }
	
	    .recommend .recommend-bd .am-gallery-default > li:nth-child(2n+1) {
	        padding-right: 4px;
	
	    }
	
	    .recommend .recommend-bd .am-gallery-item h3 {
	        font-size: 9pt;
	        color: #424141;
	        letter-spacing: .5px;
	        font-weight: 700;
	        padding: 0 7px;
	    }
	
	    .recommend .recommend-bd .am-gallery-item .am-gallery-desc {
	        margin: 10px 0px;
	        height: 51px;
	
	    }
	
	    .scrollspy-nav a.am-active:after {
	        width: 20%;
	        left: 37px;
	        top: 88%;
	    }
	
	    .recommend .recommend-bd .am-gallery-item img {
	        border-top-left-radius: 10px;
	        border-top-right-radius: 10px;
	        height: 121px;
	        border-bottom-left-radius: 0px;
	        border-bottom-right-radius: 0px
	    }
	
	    .recommend .recommend-bd .am-gallery-item h3 {
	        font-size: 9pt;
	        color: #424141;
	        letter-spacing: .5px;
	        font-weight: 700;
	        padding: 0px 8px;
	    }
	
	    .recommend .recommend-bd .am-gallery-default > li {
	        margin-bottom: 0px;
	    }
	
	    .payment-footer {
	        display: flex;
	        align-items: center;
	        background-color: #fff;
	        padding: 0 15px;
	        height: 50px;
	        box-shadow: 0px -1px 3px rgba(0, 0, 0, 0.05);
	    }
	
	    .payment-footer .service-collection {
	        flex: 1;
	        display: flex;
	    }
	
	    .payment-footer .buy-now {
	        flex: 2;
	        color: #fff;
	        font-size: 17px;
	        text-align: center;
	        margin-left: 15px;
	    }
	
	    .payment-footer .buy-now {
	        flex: 2;
	        color: #fff;
	        font-size: 14px;
	        text-align: center;
	        margin-left: 15px;
	    }
	
	    .baoyou {
	        margin-left: 15px;
	        margin-bottom: 10px;
	        width: 48px;
	        height: 18px;
	        background: rgba(255, 229, 226, 1);
	        opacity: 1;
	        border-radius: 9px;
	        font-size: 12px;
	        text-align: center;
	        font-weight: 400;
	        line-height: 1px;
	        color: rgba(255, 0, 0, 1);
	        opacity: 1;
	    }
	
	    .recommend .recommend-bd ul {
	        padding: 5px 0 10px
	    }
	
	    .am-gallery-default > li {
	        width: 46%;
	    }
	
	    .recommend .recommend-bd .am-gallery-item {
	        box-shadow: 5px 10px 9px #eee;
	    }
	
	    .recommend .recommend-bd .am-gallery-default > li:nth-child(2n+1) {
	        padding-right: 0px !important;
	        float: left;
	        margin-left: 10px
	    }
	
	    .recommend .recommend-bd .am-gallery-default > li:nth-child(2n) {
	        padding-left: 0px !important;
	        float: right;
	        margin-right: 10px
	    }
	
	    .recommend .recommend-bd .am-gallery-item {
	        border-radius: 10px !important;
	    }
	    #addCarts {
	        background: -webkit-linear-gradient(left, #ffd01e, #ff8917);
	        background: linear-gradient(to right, #ffd01e, #ff8917);
	        height: 40px;
	        font-weight: 500;
	        font-size: 14px;
	        border: none;
	        border-radius: 0;
	        overflow: hidden;
	        position: relative;
	        display: inline-block;
	        box-sizing: border-box;
	        margin: 0;
	        padding: 0;
	        line-height: 1.2;
	        text-align: center;
	        -webkit-box-flex: 1;
	        -webkit-flex: 1;
	        flex: 1;
	        height: 40px;
	        font-weight: 500;
	        font-size: 14px;
	        border: none;
	        border-radius: 0;
	        margin-left: 5px;
	        border-top-left-radius: 999px;
	        border-bottom-left-radius: 999px;
	    }
	    #addCarts:before {
	        position: absolute;
	        top: 50%;
	        left: 50%;
	        width: 100%;
	        height: 100%;
	        background-color: #000;
	        border: inherit;
	        border-color: #000;
	        border-radius: inherit;
	        -webkit-transform: translate(-50%, -50%);
	        transform: translate(-50%, -50%);
	        opacity: 0;
	        content: ' ';
	     }
	    #goCarts {
	        background: -webkit-linear-gradient(left, #ff6034, #ee0a24);
	        background: linear-gradient(to right, #ff6034, #ee0a24);
	        height: 40px;
	        font-weight: 500;
	        font-size: 14px;
	        border: none;
	        border-radius: 0;
	        overflow: hidden;
	        position: relative;
	        display: inline-block;
	        box-sizing: border-box;
	        margin: 0;
	        padding: 0;
	        line-height: 1.2;
	        text-align: center;
	        -webkit-box-flex: 1;
	        -webkit-flex: 1;
	        flex: 1;
	        height: 40px;
	        font-weight: 500;
	        font-size: 14px;
	        border: none;
	        border-radius: 0;
	        margin-right: 5px;
	        border-top-right-radius: 999px;
	        border-bottom-right-radius: 999px;
			border-top-left-radius: 999px;
			border-bottom-left-radius: 999px;
	    }
	    #goCarts:before {
	        position: absolute;
	        top: 50%;
	        left: 50%;
	        width: 100%;
	        height: 100%;
	        background-color: #000;
	        border: inherit;
	        border-color: #000;
	        border-radius: inherit;
	        -webkit-transform: translate(-50%, -50%);
	        transform: translate(-50%, -50%);
	        opacity: 0;
	        content: ' ';
	    }
	
	    .payment-footer .buy-now {
	        overflow: hidden;
	    }
	    .buy {
	        flex: 3;
	        margin-left: 25px;
	        display: flex;
	        color: #fff;
	    }
		.payment-footer .service-collection>a img {
		    width: 20px;
		}
		
		.payment-footer .service-collection>a span {
		    line-height: 20px;
		}
		
		.payment-footer .service-collection>a {
		    flex: 1;
		    display: flex;
		    flex-direction: column;
		    align-items: center;
		    justify-content: center;
		    color: #a5a6a6;
		    font-size: 14px;
		}
		.op{
			color: grey;
			font-weight: 600;
			margin-top: 7px;
			padding-left: 0px;
			font-size: 12px;
			padding-right: 25px;
			border: none;
			margin-top: -4px;
			text-decoration: line-through
		}
</style>
</head>
<body>
<div class="container" id="app">
    <header data-am-widget="header" class="am-header am-header-default my-header hearbc">
        <div class="am-header-left am-header-nav">
            <a href="javascript:history.back(-1);" class="" style="color: #000000;">
                <i class="am-header-icon am-icon-chevron-left"></i>
            </a>
        </div>
        <!-- <h1 class="am-header-title h1w">
            <a href="#title-link" class=" textwei">@{{ goods.goodsname }}</a>
        </h1> -->
    </header>
    <!-- banner -->

    {{--<div class="am-slider am-slider-default" data-am-flexslider id="demo-slider-0">--}}
        {{--<ul class="am-slides">--}}
            {{--<li><img src="http://s.amazeui.org/media/i/demos/bing-1.jpg" /></li>--}}
            {{--<li><img src="http://s.amazeui.org/media/i/demos/bing-2.jpg" /></li>--}}
        {{--</ul>--}}
    {{--</div>--}}

    <template>
        <div class="block">
            <el-carousel :height="screenheight">
                <el-carousel-item v-for="item in goodsImgName">
                  <img :src="item.img" width="100%" height="100%">
                </el-carousel-item>
            </el-carousel>
        </div>
    </template>





    <div class="gray-panel">
        <div class="paoduct-title-panel">
            <h1 class="product-h1 textwei">@{{ goods.goodsname }}</h1>
            <p><span class="am-fr product-title-gray-text">
			<!-- <i class="am-icon-star"></i>收藏 -->
			</span>
				<span class="bold" style="margin-left: -10px;color: red;
">运营师价：</span><span class="red2">￥@{{ goods.rulingprice }}</span>&nbsp;&nbsp;
				<span class="op">原价：@{{ goods.originalprice }}</span>
			<span class=" textwei" style="float: right;">PV值:<span style="font-weight: 100;">@{{ goods.pk_integral }}</span></span>
        </div>
		
        <div class="my-search-title-panel">


            <div class="m    arch-title-panel" id="clothes_type" style="display: none;">
                <div class="first-each-div" v-for="v,i in specsList" >
                    <p class="my-search-titp-p am-text-sm bold specs-p">@{{ v.name }}</p>
                    <div v-for="val,index in specsLists" >
                        <div v-if = "val.specs_id == v.id"  class="you specs" >
                           <div class="clothes-div" v-for="j,m in val.vals">
                                <button type="button" class="am-btn am-btn-default specs" checkSpecs="2" v-on:click="checkedSpecs( j.id )"  :id="'specs-btnss'+j.id">@{{ j.val }}</button>    
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div >
            <p class="my-search-titp-p am-text-sm bold" style="float: left;">数量:</p>
            <div style="overflow:hidden;float: right;">
                <form class="am-form-inline" role="form">
                    <button type="button" class="am-btn am-btn-default" style="float:left;border: none;background-color: white;" v-on:click="numberMinus()"><i class="am-icon-minus"></i></button>
                    <input type="number" name="txtQty" v-model="number" class="am-form-field txt-qty am-text-center am-text-sm" style=" width:60px; margin-right:0px; height:40px; display:inline; float:left;border-radius: 14px;">
                    <button type="button" class="am-btn am-btn-default" style="float:left;border: none;background-color: white;" v-on:click="numberAdd()"><i class="am-icon-plus"></i></button>
                </form>
            </div>
           </div>


            {{--<span v-show="goods.rulingprice < MicroLeve.conditions">--}}
                 {{--<button type="button" class="am-btn am-btn-default am-radius am-btn-block" >低于现在等级</button>--}}
            {{--</span>--}}
            <div>
                <ul class="am-avg-sm-2 am-text-center">
                   <!--  <li class="am-text-center am-padding-sm" v-show="specsExist == 0 "><button type="button" class="am-btn am-btn-success am-btn-block am-radius" v-on:click="car(goods.id)">加入购物车</button></li>
                    -->
                    <li v-show="aa == null" class="am-text-center am-padding-sm" ><button type="button" class="am-btn am-btn-success am-btn-block am-radius" v-on:click="car(goods.id)" style="border-radius: 50px;background-color:#33c193" >加入购物车</button></li>



                   <!-- <li id="buy" class="am-text-center am-padding-sm" >
                        <button  type="button" class="am-btn  am-btn-block am-radius" v-on:click="add(goods.id)" style="border-radius: 50px;background-color: black;color: rgb(255,215,0);">立即购买</button>
                    </li> -->
                </ul>
            </div>
        </div>
    </div>
    <!-- 商品详情 -->
    <div data-am-widget="tabs" class="am-tabs am-tabs-d2">
        <ul class="am-tabs-nav am-cf">
            <li class="am-active" style="border: none;">
                <a href="[data-tab-panel-0]">详情</a>
            </li>
            <!-- <li class="">
                <a href="[data-tab-panel-1]">交易记录</a>
            </li> -->
        </ul>
        <div class="am-tabs-bd">
            <div data-tab-panel-0 class="am-tab-panel am-active" v-html="goods.spec"></div>
            <div data-tab-panel-1 class="am-tab-panel ">

                <ul class="am-list am-list-static am-list-border am-list-striped am-text-sm">
                    <li v-for="val in orderData" v-if="orderData.length">@{{ val.name }}于@{{ val.createtime }}日购买成功</li>
                    <li v-if="orderData.length == 0">暂无交易记录</li>
                </ul>

            </div>
        </div>
    </div>
	<!-- <footer data-am-widget="navbar" class="am-navbar am-cf sxy-footer" id="" style="background-color: #FFFFFF;">
	    
			<ul class="am-navbar-nav  am-avg-sm-4">
	       <li>
	            <a href="/home/excellent/index" class="footer-active">
	                <img src="http://qiniu.baoliy168.com/59a0ad73e1a3c6b04ba38db22e44a7ea.png" alt="首页"/>
	                <span class="am-navbar-label">首页</span>
	            </a>
	        </li>
	      <li>
	          <a href="tel:15736167565" class="">
	              <img src="http://hb.baoliy168.com/shops/assets/images/kf.png" alt="分类" />
	              <span class="am-navbar-label">客服</span>
	          </a>
	      </li>
		  <li>
			  
		  </li>
	      
	       <li id="buy" class="am-text-center am-padding-sm" style="padding: 0px;">
	           <button  type="button" class="am-btn  am-btn-block am-radius" v-on:click="add(goods.id)" style="border: none;border-radius: 50px;background: linear-gradient(to right, #ff6034, #ee0a24);color: rgb(255,255,255);">立即购买</button>
	       </li>
	    </ul>
	</footer> -->
	
	<footer data-am-widget="navbar" class="am-navbar am-cf sxy-footer payment-footer" id="" v-cloak>
	    <div class="service-collection">
	        <a href="/home/excellent/index">
	            <img src="http://qiniu.baoliy168.com/%E7%BB%84%203478%403x.png" alt="">
	            <span style="color:#333333;font-size:10px">首页</span>
	        </a>
	        <a href="tel:15882274651">
	            <img src="http://qiniu.baoliy168.com/ea63deb441909e477434142e0bb02ed.png" alt="">
	            <span style="color:#333333;font-size:10px">客服</span>
	        </a>
	    </div>
	    <div class="buy">
	        <!-- <button id="addCarts" v-on:click="car(goods.id)">加入购物车</button> -->
	        <button id="goCarts" v-on:click="add(goods.id)" style="font-size: 16px;">立即购买</button>
	    </div>
	</footer>
	
</div>
</body>
<script type="text/javascript">
    function checkedSpecs(e)
    {
        var checkSpecs = $("#specs-btnss"+e).attr( "checkSpecs" );
        if ( checkSpecs == 1 ) {
            $("#specs-btnss"+e).attr( "checkSpecs", 2 );
            $("#specs-btnss"+e).css("background","#919891");
        } else {
            $("#specs-btnss"+e).attr( "checkSpecs", 1 );
            $("#specs-btnss"+e).css("background","#5bb95b");
            $("#specs-btnss"+e).parent('.clothes-div').siblings('').find('button').attr( "checkSpecs", 2 );
            $("#specs-btnss"+e).parent('.clothes-div').siblings('').find('button').css("background","#919891");
        }
    }
</script>
<script>


	// $(function (){
	// 	var width = window.screen.width;
	// 	console.log(width);
	// 	$(".el-carousel__container").css('height',900);
	// })

    var app = new Vue({
        el: "#app",
        data: {
            hostUrl:"http://www.baoli.com",
            goods:[],
            goodsImgName:[],
            number:1,
            MicroLeve:[],//商城等级
            user:[],//会员
            orderData:{},//交易记录
            //商品规格名
            specsList :{},
            //商品规格名--值
            specsLists:{},
            specsExist:0,
			aa:'',
			screenheight:window.screen.width/1.3+"px",
        },
        //事件
        methods: {
            //初始化 系统管理员列表
            initialize:function () {
                var id = this.obtain('id');
				var aa = this.obtain('aa');
				
                    //获取商品数据
                    $.post("/home/excellent/goods",{'_token':'{{csrf_token()}}',class:'find',id:id},function (res) {
                        if(res.code){
                            app.goods = res.data.goods;
                            app.specsList = res.GoodsSpecsName;
                            app.specsLists = res.GoodsSpecsVal;
							app.aa = aa;
							if(app.aa == 1){
								$('#buy').css('width','100%')
							}
                            if ( app.specsList.length != 0 ) {
                                $("#clothes_type").show();
                                app.specsExist = 1;
                            }
                            app.number = app.goods.purchase_num;
                            app.goodsImgName = res.data.goodsImgName;
                            app.user = res.data.user;
                            app.orderData = res.orderData;
                            app.MicroLeve = res.data.MicroLeve;
                        } else {
                            layer.msg(res.data,{icon:7});
                        }
                    });

            },
            numberAdd:function () { //加
                if( app.number > app.goods.total || app.number == '') {
                    layer.msg('数量不对');return;
                }
                // app.number += 1;
				app.number++;
            },
			numberMinus:function () { //减
			    if(app.number <= app.goods.purchase_num || app.number == '') {
			        layer.msg('不能少于起购数量');return;
			    }
			    // app.number -= 1;
				app.number--;
			},
            //生成订单
            add:function (id) {
               /*if ( id == undefined ) {
                    layer.msg("此产品正在升级中,请耐心等待,谢谢!");
                    return false;
                }*/

                var specs = '';
                var specsCheckData = [];
                if ( app.specsExist == 1 ) {
                    $(".specs-p").siblings('div').find("button").each(function(){
                        if ( $(this).attr("checkSpecs") == 1 ) {
                            specsCheckData.push( $(this).attr("checkSpecs") );
                        }
                    });
                    if ( app.specsList.length != specsCheckData.length ) {
                        layer.msg('请完整选择产品规格!');return false;
                    }
                    $(".clothes-div button").each(function(){
                        if ( $(this).attr("checkSpecs") == 1 ) {
                            var specsName = $(this).parents('.first-each-div').children('p').html();
                            var specsVal = $(this).html();
                            specs = specs+specsName+':'+specsVal+';';
                        }
                    });
                    if ( specs == '' ) {
                        layer.msg('请选择产品规格');return false;
                    }
                }
                app.number = parseInt(app.number);
                if(app.number < app.goods.purchase_num || app.number > app.goods.total || app.number == ''){
                    layer.msg('请输入正确的数量');
                    return;
                }
				
                layer.load(2);
                $.post("/home/excellent/excellentOrder",{
                    '_token':'{{csrf_token()}}',
                    class:'add',
                    type:0,
                    specsExist:app.specsExist,
                    specslength:app.specsList.length,
                    Checklength:specsCheckData.length,
                    goods:[
                        {
                            goodsid:id,
                            number:app.number,
                            specs:specs,
                            id:''
                        }
                    ]
                },function (res) {
                    layer.closeAll('loading');
                    if(res.code){
                        layer.msg(res.data.data);
                        window.location.href="/home/orderpage?id="+res.data.id;
                    } else {
                        layer.msg(res.data,{icon:7});
                    }
                });
            },


            car:function (id) {
                /* if ( id == undefined ) {
                    layer.msg("此产品正在升级中,请耐心等待,谢谢!");
                    return false;
                }*/

                var specs = '';
                var specsCheckData = [];
                if ( app.specsExist == 1 ) {
                    $(".specs-p").siblings('div').find("button").each(function(){
                        if ( $(this).attr("checkSpecs") == 1 ) {
                            specsCheckData.push( $(this).attr("checkSpecs") );
                        }
                    });
                    if ( app.specsList.length != specsCheckData.length ) {
                        layer.msg('请完整选择产品规格!');return false;
                    }
                    $(".clothes-div button").each(function(){
                        if ( $(this).attr("checkSpecs") == 1 ) {
                            var specsName = $(this).parents('.first-each-div').children('p').html();
                            var specsVal = $(this).html();
                            specs = specs+specsName+':'+specsVal+';';
                        }
                    });
                    if ( specs == '' ) {
                        layer.msg('请选择产品规格');return false;
                    }
                }
                if(app.number < app.goods.purchase_num || app.number > app.goods.total || app.number == '' || isNaN(parseInt(app.number))){
                    layer.msg('请输入正确的数量');
                    return;
                }
                $.post("/home/microShop/car", {
                    '_token': '{{csrf_token()}}',
                    class:'add',
                    goodsid:id,
                    number:app.number,
                    specs:specs,
                    specsExist:app.specsExist,
                    specslength:app.specsList.length,
                    Checklength:specsCheckData.length
                }, function (res) {
                    if (res.code) {
                        layer.msg(res.data,{icon:7});
                    } else {
                        layer.msg(res.data,{icon:7});
                    }
                });
            },
            //获取url id
            obtain:function (val) {
                var query = window.location.search.substring(1);
                var vars = query.split("&");
                for (var i=0;i<vars.length;i++) {
                    var pair = vars[i].split("=");
                    if(pair[0] == val){
                        return pair[1];
                    }
                }
            },
        },
        //自动执行
        mounted: function () {
            this.initialize();
        },
    });
</script>
</html>
